package com.sxhuangjiang.litadmin.config;

import com.sxhuangjiang.litadmin.common.Res;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author huang
 * @version V1.0
 * @date 2019-11-08 14:42
 */
@ControllerAdvice
@Slf4j
public class GlobalControllerExceptionHandler {
    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public Res exceptionHandler(Exception ex) {
        log.error("捕获到EXCEPTION异常",ex);
        return Res.err(ex);
    }
}
